package Lib3d.SceneGraph.Impl;


import Lib3d.Vector3d;
import Lib3d.SceneGraph.Rotation;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;

/**
 * An implementation of the rotation tranformation for the scene graph child.
 * 
 * @author Wassim Chegham
 * @author Miriam Baran-Surel
 * @version 0.1
 * @category Lib3d.SceneGraphImpl
 * 
 */
public class RotationImpl extends TransformImpl implements Rotation {

    private Vector3d axis;
    private float angle;

    public RotationImpl(final Vector3d axis, final float angle) {
        this.axis = axis;
        this.angle = angle;
    }

    @Override
    public void draw(final GLAutoDrawable gLDrawable) {

        final GL gl = gLDrawable.getGL();
        gl.glRotatef(this.angle, this.axis.get(0), this.axis.get(1), this.axis.get(2));
        super.draw(gLDrawable);
    }

    public float getAngle() {
        return this.angle;
    }

    public Vector3d getAxis() {
        return this.axis;
    }

    public void setAngle(final float angle) {
        this.angle = angle;

    }

    public void setAxis(final Vector3d axis) {
        this.axis = axis;

    }

}
